/*****************************************************************************
*
* File: hw_init.c
*
* Description: Contains functions to initialized hardware on MCU.
*
* Author: Kevin Casteel, Luis Castillo
*
* Revisions: v-1.0 (4/18/11)
*            v-1.1 (4/22/11)
*
******************************************************************************/

#include <avr/io.h>
#include <avr/interrupt.h>
#include "hw_init.h"
#include "spi_sseg.h"


/*---------------------------------------------------------
* Function: vIO_init
*
* Description: Function initializes port data direction
* 			   and clears it.
*---------------------------------------------------------*/
void vIO_init(void) 
{
    //- set PortA as output
	DDRA = (_BV(PIN0) | _BV(PIN2)); 
    PORTA = 0xFF;
}


/*---------------------------------------------------------
* Function: vSSEG_init
*
* Description: Function initializes sseg display
*---------------------------------------------------------*/
void vSSEG_init(void) 
{
    //- clear sseg display and set brightness
	SPI_MasterInit();
	SSEG_Reset();
	SSEG_Set_Brightness(0x00);
}

